package com.dxd.onlineshop.service;

import com.dxd.onlineshop.pojo.Order;
import com.dxd.onlineshop.pojo.OrderItem;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.math.BigDecimal;
import java.util.List;

public interface OrderService {
    // 创建订单
    Order createOrder(Integer userId, List<OrderItem> orderItems);

    // 获取用户的所有订单
    List<Order> getUserOrders(Integer userId);

    // 获取单个订单详情(通过订单ID)
    Order getOrderById(Integer orderId);

    // 更新订单状态
    boolean updateOrderStatus(Integer orderId, Order.OrderStatus newStatus);

    // 取消订单
    boolean cancelOrder(Integer orderId);

    // 删除订单
    boolean deleteOrder(Integer orderId);

    // 获取订单统计信息（例如，总订单数，总金额等）
    OrderStatistics getOrderStatistics(Integer userId);

    // 内部类，用于订单统计
    @Setter
    @Getter
    @AllArgsConstructor
    @NoArgsConstructor
    class OrderStatistics {
        private int totalOrders;
        private BigDecimal totalAmount;
    }
}